import config.Config;
import file.FileStatistics;
import org.apache.log4j.Logger;
import utils.VideoCutUtil;

import javax.swing.plaf.nimbus.State;
import java.io.File;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author：xingquanxiang createTime:2020/4/29 11:37
 * description:
 */
public class Application {
    private static Logger logger = Logger.getLogger(Application.class);
    public static void main(String[] args) {
        //对视频时长大于30分钟的文件 切割
        // cutVideo();
        //为视频添加片头
        // spliceVideo();
        System.out.println("1 = " + 1);
        System.out.println("Config.getResourceDirectory() = " + Config.getResourceDirectory());
        System.out.println("1 = " + 1);
        System.out.println("Config.getFfmpegPath() = " + Config.getFfmpegPath());
        System.out.println("Config.getHeadVideoPath() = " + Config.getHeadVideoPath());
    }

    public static void cutVideo(){
        FileStatistics statistics = new FileStatistics();
        File file = new File("L:\\老鹰\\色彩\\色彩单体课件\\08");
        statistics.traverseCutVideo(file);
        int count = FileStatistics.count;
        long totalSize = FileStatistics.totalSize;
        long totalTime = FileStatistics.totalTime;
        long totalL = FileStatistics.totalL;
        logger.info("视频总数：" + count);
        count = 0;
        BigDecimal divide = new BigDecimal(totalSize).divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP);
        logger.info("视频总大小" + divide + "MB");
        totalSize = 0;
        logger.info("视频总时长：" + totalTime / 3600000 + "时" + (totalTime % 3600000) / 60000 + "分" + ((totalTime % 3600000) % 60000) / 1000 + "秒");
        totalTime = 0;
        logger.info("------------------------");

        System.out.println("一共剪辑次数： " + totalL);
    }

    public static void spliceVideo(){
        FileStatistics statistics = new FileStatistics();
        File file = new File("F:\\老鹰");
        statistics.traverseSpliceVideo(file);
    }
}
